package cn.shuangliang.contract.web;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import java.sql.SQLException;

/**
 * @author oldliu
 * @since 1.0
 */
@ControllerAdvice//全局
public class MyExceptionHandler {
   @ExceptionHandler
    public String ex1(Exception e){//Exception或者子类。。。
       e.printStackTrace();
       System.out.println("出现了异常"+e);
        return "fail2";//视图地址
    }
}
